package com.xoa.controller.attend;

/**
 * Created by gsb on 2017/7/12.
 */

import com.xoa.util.CookiesUtil;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.dataSource.ContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * 考勤页面Controller
 */
@Controller
@RequestMapping("/attendPage")
public class AttendPageController {
  @RequestMapping("/myAttendance")
    public String myAttendance(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/myAttendance";
    }
    @RequestMapping("/backlogAttendLeave")
    public String backlogAttendLeave(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/attendLeave/backlogAttendLeave";
    }
    @RequestMapping("/myAttendLeave")
    public String myAttendLeave(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/attendLeave/myAttendLeave";
    }
    @RequestMapping("/myAttendEvection")
    public String myAttendEvection(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/myAttendEvection";
    }
    @RequestMapping("/myAttendOut")
    public String myAttendOut(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/myAttendOut";
    }
    @RequestMapping("/attendance")
    public String attendance(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/index";
    }

//考勤统计数据和考勤量化结果  页面映射
    @RequestMapping("/quantitative")
    public String quantitative(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/quantitative";
    }

    //因公缺勤  页面映射
    @RequestMapping("/publicAbsence")
    public String publicAbsence(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/publicAbsence";
    }

    //因私缺勤  页面映射
    @RequestMapping("/privateAbsence")
    public String privateAbsence(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/privateAbsence";
    }
    //请假统计  页面映射
    @RequestMapping("/privateAbsences")
    public String privateAbsences(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/privateAbsences";
    }
    @RequestMapping("/personnelStatistics")
    public String personnelStatistics(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/personnelStatistics";
    }
//地图
    @RequestMapping("/attendanceMap")
    public String attendanceMap(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/attendanceMap";
    }
    @RequestMapping("/statisticsDetail")
    public String statisticsDetail(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/statisticsDetail";
    }
    @RequestMapping("/details")
    public String details(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/details";
    }
    @RequestMapping("/leaveManagement")
    public String leaveManagement(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/leaveManagement";
    }
    @RequestMapping("/reportForm")
    public String reportForm(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/reportForm";
    }
    //考察详情
    @RequestMapping("/detailsTtendance")
    public String detailsTtendance(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/attend/statistic/myAttendance";
    }


    //H5微应用
    //首页
    @RequestMapping("/attendIndexh5")
    public String attendIndex() { return "/app/attend/m/indexh5"; }
    //考勤统计
    @RequestMapping("/attendCounth5")
    public String attendCount() { return "/app/attend/m/kqtj_indexh5"; }
    //编辑签到类型
    @RequestMapping("/attendAddtypeh5")
    public String attendAddtype() { return "/app/attejnd/m/addtypeh5"; }
    //外勤签到
    @RequestMapping("/attendWindexh5")
    public String attendWindex() { return "/app/attend/m/windexh5"; }
}
